//
//  ViewController.m
//  02-hitTest练习
//
//  Created by J on 16/2/20.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"
#import "PurpleView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)chatView:(PurpleView *)sender {
    
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        UIButton* chatView = [UIButton buttonWithType:UIButtonTypeCustom];
        chatView.bounds = CGRectMake(0, 0, 200, 200);
        chatView.center = CGPointMake(100, -100);
        [chatView setBackgroundImage:[UIImage imageNamed:@"小孩"] forState:UIControlStateHighlighted];
        [chatView setBackgroundImage:[UIImage imageNamed:@"对话框"] forState:UIControlStateNormal];
        [sender addSubview:chatView];
        sender.chatView = chatView;
    });
    
}



@end
